package mao.thinkinjava.interupt;

/**
 * @author Totoro
 * @date 2020/5/11 20:07
 */
public class SynchronizeBlocking implements Runnable {
    SynchronizeBlocking(){
       new Thread(() -> f()).start();
    }
    @Override
    public void run() {
        System.out.println("before get lock");
            f();
        System.out.println("get lock");
    }
    public synchronized void f(){
        while (true){
            Thread.yield();
        }
    }
}
